package com.zbkj.service.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.user.*;
import com.zbkj.common.request.*;
import com.zbkj.common.response.MonitorResponse;
import com.zbkj.common.response.UserIntegralDetailResponse;
import com.zbkj.common.response.UserIntegralResponse;
import com.zbkj.service.util.IntegralUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 用户积分记录Service
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
public interface UserIntegralDetailService extends IService<UserIntegralDetail> {

    /**
     * 根据订单编号、uid获取记录列表
     * @param orderNo 订单编号
     * @param uid 用户uid
     * @return 记录列表
     */
    List<UserIntegralDetail> findListByOrderIdAndUid(String orderNo, Integer uid);



//    --------------------------begin-------------------------------------
    UserIntegralDetail getDetailByCondition(Integer uid, String integralType, Integer changeType, BigDecimal value, String status);
    Boolean updateDetailByCondition(String hopeType, Integer uid, String integralType, Integer changeType, BigDecimal value, String status);



    /**
     * 列表
     *
     * @param request          请求参数
     * @param pageParamRequest 分页类参数
     * @return List<UserBill>
     */
    List<UserIntegralDetail> getList(FundsMonitorSearchRequest request, PageParamRequest pageParamRequest);

    /**
     * 新增/消耗  总金额
     *
     * @param changeType       Integer 0 = 支出 1 = 获得
     * @param userId   Integer 用户uid
     * @param integralType String 类型
     * @param date     String 时间范围
     * @return UserIntegralDetail
     */
    BigDecimal getAllBigDecimal(Integer userId, Integer changeType, String integralType, String date);
//    BigDecimal getAllValueAddIntegral(Integer uid, Integer changeType);
//    BigDecimal getAllGreenIntegral(Integer uid, Integer changeType);
//    BigDecimal getAllContributionIntegral(Integer uid, Integer changeType);
//    BigDecimal getAllBalance(Integer uid, Integer changeType);
//
//    BigDecimal getAllCbfunds(Integer uid, Integer changeType);

    /**
     * 保存退款日志
     *
     * @return boolean
     */
    Boolean saveRefundDetail(StoreOrderRefundRequest request, UserIntegral userIntegral, String integralType);

//    /**
//     * 资金监控
//     *
//     * @param request          查询参数
//     * @param pageParamRequest 分页参数
//     * @return PageInfo
//     */
//    PageInfo<MonitorResponse> fundMonitoring(FundsMonitorRequest request, PageParamRequest pageParamRequest);


//    ----------------------------end-------------------------------------


    /**
     * PC后台列表
     * @param request 搜索条件
     * @param pageParamRequest 分页参数
     * @return 记录列表
     */
    PageInfo<UserIntegralDetailResponse> findAdminValueAddList(AdminIntegralSearchRequest request, PageParamRequest pageParamRequest);
    PageInfo<UserIntegralDetailResponse> findAdminGreenList(AdminIntegralSearchRequest request, PageParamRequest pageParamRequest);
    PageInfo<UserIntegralDetailResponse> findAdminContributionList(AdminIntegralSearchRequest request, PageParamRequest pageParamRequest);
    PageInfo<UserIntegralDetailResponse> findAdminBalanceList(AdminIntegralSearchRequest request, PageParamRequest pageParamRequest);
    PageInfo<UserIntegralDetailResponse> findAdminCbfundsList(AdminIntegralSearchRequest request, PageParamRequest pageParamRequest);

//    /**
//     * 根据类型条件计算积分总数
//     * @param uid 用户uid
//     * @return 积分总数
//     */
//    BigDecimal getSumValueAddIntegral(Integer uid);
//    BigDecimal getSumGreenIntegral(Integer uid);
//    BigDecimal getSumContributionIntegral(Integer uid);
//    BigDecimal getSumBalance(Integer uid);
//
//    BigDecimal getSumCbfunds(Integer uid);
//
    /**
     * H5用户积分列表
     * @param uid 用户uid
     * @param pageParamRequest 分页参数
     * @return List
     */
    List<UserIntegralDetail> findUserValueAddIntegralList(Integer uid, PageParamRequest pageParamRequest);
    List<UserIntegralDetail> findUserGreenIntegralList(Integer uid, PageParamRequest pageParamRequest);
    List<UserIntegralDetail> findUserContributionIntegralList(Integer uid, PageParamRequest pageParamRequest);
    List<UserIntegralDetail> findUserBalanceList(Integer uid, PageParamRequest pageParamRequest);
    List<UserIntegralDetail> findUserCbfundsList(Integer uid, PageParamRequest pageParamRequest);

}
